{% extends 'share_layout/base.html' %}
{% load static %}

<!--首页的标题-->
{% block title %}首页{% endblock title %}

<!--首页的css js-->
{% block js %}
<script rel="preload" type="text/javascript" src="{% static 'js/jquery-3.6.0.min.js' %}"></script>
{% endblock js %}

<!--首页 顶部页面-->
{% block header-left %}
<h2>校园博客</h2>
{% endblock header-left%}

{% block header-search %}
<form action="" method="post">
    <input placeholder="搜索..." type="text" id="search"></input>
    <button type="button">搜索</button>
</form>
{% endblock header-search%}

{% block header-right %}
<div>
    {% if request.session.is_login%}
    <span>
        {{request.session.user_name}}&nbsp;&nbsp;<a href="{% url 'user:logout'%}">退出&nbsp;&nbsp;</a>
    </span>
    <span>
        <img src="{%static 'comm/img/xiewenzhang.png'%}">
        <a href="">写文章</a>
        <!-- <button class="write-btn">&nbsp写文章</button> -->
    </span>
    {% else %}
    <span>
        <!-- <button class="login-btn" onclick="javascript:window.location.href={% url 'user:login'%}">&nbsp;登陆</button> -->
        <a href="{% url 'user:login'%}">&nbsp;&nbsp;登陆</a>
    </span>
    <span>
        <!-- <button class="register-btn" onclick="javascript:window.location.href={% url 'user:register'%}">&nbsp;注册</button> -->
        <a href="{% url 'user:register'%}">&nbsp;&nbsp;注册</a>
    </span>

    <span>
        <!-- <button class="write-btn">&nbsp;&nbsp;写文章</button> -->
    </span>
    {% endif %}
</div>
{% endblock header-right%}

<!--首页导航栏-->
{% block nav %}
<span>
    <a href="">
        热门
    </a>
</span>
<span>
    <a href="">
        体育
    </a>
</span><span>
    <a href="">
        榜单
    </a>
</span><span>
    <a href="">
        视频
    </a>
</span><span>
    <a href="">
        头条
    </a>
</span>

{% endblock nav %}

<!--首页内容部分-->
{% block article %}
<div class="article-list">
    {% for article in article_list %}
    <div class="article-item">
        <h4><a href="{% url 'blog:article_detail' article.uid %}" class="article-title">{{article.title}}     </a></h4>
        <div class="article-desc">
            <span class="media-left">
                <img width="50" height="50" src="/static/{{article.user.avatar}}" />
            </span>
            <span class="media-right">
                {{article.desc}}
            </span>
            <div class="article-border">
                <span>
                    <a href="">{{article.user.name}}</a>&nbsp;&nbsp;&nbsp;
                </span>
                <span>
                    {% if article.update_time == article.pub_time %}
                    发布于&nbsp;&nbsp;{{article.pub_time|date:"Y-m-d H:m:s"}}&nbsp;&nbsp;&nbsp;
                    {% else %}
                    更新于&nbsp;&nbsp;{{article.update_time|date:"Y-m-d H:m:s" }}&nbsp;&nbsp;&nbsp;
                    {% endif %}
                </span>
                <span>
                    <img class="article-border-img" src="{% static 'blog/img/pinglun.png' %}">
                    <a href="">评论({{article.comment_count}})</a>&nbsp;&nbsp;&nbsp;
                </span>
                <span>
                    <img class="article-border-img" src="{% static 'blog/img/dianzan.png' %}">
                    <a href="">点赞({{article.up_count}})</a>&nbsp;&nbsp;&nbsp;
                </span>
                <span>
                    <img class="article-border-img" src="{% static 'blog/img/shoucang.png' %}">
                    <a href="">收藏({{article.up_count}})</a>
                </span>

            </div>
        </div>
    </div>
    {% endfor %}
</div>
{% endblock article %}


<!--首页边栏-->
{% block aside %}
<div>
    <h4>推荐作者</h4>
    <ul>
        <li>卢璐说</li>&nbsp;&nbsp;&nbsp;<a href="">+关注</a><br>
        <li>梅拾璎</li>&nbsp;&nbsp;&nbsp;<a href="">+关注</a><br>
        <li>闫泽华</li>&nbsp;&nbsp;&nbsp;<a href="">+关注</a><br>
    </ul>
</div>
<div>write</div>
{% endblock aside %}

<!--首页底部-->
{% block footer %}
北部湾大学毕业项目<br>copyright@tyh
{% endblock footer %}